package com.github.cosycode.imgtool.util;

import com.github.cosycode.common.base.RunnableWithThrow;
import com.github.cosycode.common.util.otr.PrintTool;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;

/**
 * <b>Description : </b>
 * <p>
 * <b>created in </b> 2022/1/16
 * </p>
 *
 * @author CPF
 * @since 1.0
 **/
@NoArgsConstructor(access = AccessLevel.PRIVATE)
@Slf4j
public class LogUtils {

    public static <T extends Exception> void logEvent(RunnableWithThrow<T> run, String eventName, Object... var2) throws T {
        String msg = PrintTool.format(eventName, var2);
        log.info("=========================  [{} start] =====================", msg);
        run.run();
        log.info("=========================  [{}  end ] =====================\n", msg);
    }

}
